package com.anyou.mall.platform.controller;

import javax.validation.Valid;
import com.anyou.mall.platform.dto.AboutUsDTO;
import com.anyou.mall.platform.dto.BondDTO;
import com.anyou.mall.platform.dto.BottomIconDTO;
import com.anyou.mall.platform.dto.TopBackgroundDTO;
import com.anyou.mall.platform.vo.AboutUsVO;
import com.anyou.mall.platform.vo.BondVO;
import com.anyou.mall.platform.vo.BottomIconVO;
import com.anyou.mall.platform.vo.TopBackgroundVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.anyou.common.core.controller.BaseController;
import com.anyou.common.core.domain.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.anyou.mall.platform.service.IPlaPlatformSettingsService;

/**
 * 基础设置Controller
 *
 * @author ylj
 * @date 2022-03-21
 */
@Api(tags = "平台设置-基础设置")
@RestController
@RequestMapping("/platform/basicSettings")
public class BasicSettingsController extends BaseController
{
    @Autowired
    private IPlaPlatformSettingsService plaPlatformSettingsService;

//    @ApiOperation("获取首页顶部背景")
//    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
//    @PostMapping(value = "/getTopBackground")
//    public ApiResult<TopBackgroundVO> getTopBackground()
//    {
//        return plaPlatformSettingsService.getTopBackground();
//    }
//
//    @ApiOperation("保存首页顶部背景")
//    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
//    @PostMapping(value = "/setTopBackground")
//    public ApiResult setTopBackground(@Valid @RequestBody TopBackgroundDTO dto)
//    {
//        return plaPlatformSettingsService.setTopBackground(dto, getUserId());
//    }

    @ApiOperation("获取底部导航栏图标")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getBottomIcon")
    public ApiResult<BottomIconVO> getBottomIcon()
    {
        return plaPlatformSettingsService.getBottomIcon();
    }

    @ApiOperation("保存底部导航栏图标")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setBottomIcon")
    public ApiResult setBottomIcon(@Valid @RequestBody BottomIconDTO dto)
    {
        return plaPlatformSettingsService.setBottomIcon(dto, getUserId());
    }

    @ApiOperation("获取保证金相关")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getBond")
    public ApiResult<BondVO> getBond()
    {
        return plaPlatformSettingsService.getBond();
    }

    @ApiOperation("保存保证金相关")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setBond")
    public ApiResult setBond(@Valid @RequestBody BondDTO dto)
    {
        return plaPlatformSettingsService.setBond(dto, getUserId());
    }

    @ApiOperation("获取基础设置")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getAboutUs")
    public ApiResult<AboutUsVO> getAboutUs()
    {
        return plaPlatformSettingsService.getAboutUs();
    }

    @ApiOperation("保存基础设置")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setAboutUs")
    public ApiResult setAboutUs(@Valid @RequestBody AboutUsDTO dto)
    {
        return plaPlatformSettingsService.setAboutUs(dto, getUserId());
    }

    @ApiOperation("获取用户协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getUserAgreementInfo")
    public ApiResult getUserAgreementInfo()
    {
        return plaPlatformSettingsService.getUserAgreementInfo();
    }

    @ApiOperation("保存用户协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setUserAgreementInfo")
    public ApiResult setUserAgreementInfo(@RequestParam String userAgreementInfo)
    {
        return plaPlatformSettingsService.setUserAgreementInfo(userAgreementInfo, getUserId());
    }

    @ApiOperation("获取隐私政策")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getPrivacyPolicy")
    public ApiResult getPrivacyPolicy()
    {
        return plaPlatformSettingsService.getPrivacyPolicy();
    }

    @ApiOperation("保存隐私政策")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setPrivacyPolicy")
    public ApiResult setPrivacyPolicy(@RequestParam String privacyPolicy)
    {
        return plaPlatformSettingsService.setPrivacyPolicy(privacyPolicy, getUserId());
    }

    @ApiOperation("获取商家入驻协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getAutoPartsSettledAgreement")
    public ApiResult getAutoPartsSettledAgreement()
    {
        return plaPlatformSettingsService.getAutoPartsSettledAgreement();
    }

    @ApiOperation("保存商家入驻协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setAutoPartsSettledAgreement")
    public ApiResult setAutoPartsSettledAgreement(@RequestParam String autoPartsSettledAgreement)
    {
        return plaPlatformSettingsService.setAutoPartsSettledAgreement(autoPartsSettledAgreement, getUserId());
    }

    @ApiOperation("获取商家保证金支付协议和开店协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:query')")
    @PostMapping(value = "/getAutoPartsPaymentAgreement")
    public ApiResult getAutoPartsPaymentAgreement()
    {
        return plaPlatformSettingsService.getAutoPartsPaymentAgreement();
    }

    @ApiOperation("保存商家保证金支付协议和开店协议")
    @PreAuthorize("@ss.hasPermi('platform:basicSettings:edit')")
    @PostMapping(value = "/setAutoPartsPaymentAgreement")
    public ApiResult setAutoPartsPaymentAgreement(@RequestParam String autoPartsPaymentAgreement)
    {
        return plaPlatformSettingsService.setAutoPartsPaymentAgreement(autoPartsPaymentAgreement, getUserId());
    }





}
